package com.the8thfold.anton.users

import grails.plugin.multitenant.core.groovy.compiler.MultiTenant

class User {

    Integer userTenantId
	String userId
    String username
    String emailAddress
    String firstName
    String lastName
	String password
	boolean enabled
	boolean accountExpired
	boolean accountLocked
	boolean passwordExpired

    Date dateCreated

	static constraints = {
		username blank: false, unique: true
		password blank: false
        emailAddress nullable: true, blank: true, unique: true
	}

	static mapping = {
		password column: '`password`'
	}

	Set<Role> getAuthorities() {
		UserRole.findAllByUser(this).collect {
            it.role
        } as Set
	}
}
